<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<jsp:include page="../../../common/head.jsp">
			 <jsp:param name="_useTab" value="true"/>
			 <jsp:param name="_useCalendar" value="true"/>
		</jsp:include>

		<title>汇总上报修改</title>
		<script language="JavaScript">
			function saveData(){
				var objarr = new Array(
					["feeReport.feeReportCode","编号","notEmpty",""]
				);
				if(xj.CheckAll(objarr))
				{
					if(confirm("确认保存？"))
					{
						document.getElementById("form1").submit();
					}
				}
			}
			//向当前上报信息中添加费用明细
			function addData()
			{
				var a = ModalWindow("jump.do?path=selectFeeDetail.do&feeReport.feeReportId=${feeReport.feeReportId}",0,0);
				if(a!=null)
					window.location.href = "updateReportFeeDetail.do?fromType=fromEdit&feeReportId=${feeReport.feeReportId}";
			}
			function editData(feeId)
			{
				var a = ModalWindow("jump.do?path=updateFeeDetail.do&fromType=reportEdit&feeId="+feeId,800,600);
				if(a!=null)
					window.location.href = "updateReportFeeDetail.do?fromType=fromEdit&feeReportId=${feeReport.feeReportId}";
			}
			//数据上报
			function reportData(feeReportId)
			{
				if(confirm("确认上报？"))
				{
					ModalWindow("jump.do?path=reportFeeDetail.do&feeReportId="+feeReportId,640,480);
					window.location.href="listReportFeeDetail.do";
				}
			}
			//移除费用信息
			function deleteData(feeId)
			{
				if(confirm("确认从当前上报信息中移除该条费用数据？"))
				{
					var a  = ModalWindow("jump.do?path=removeFeeDetail.do&feeId="+feeId,640,480);
					if(a!=null)
						window.location.href = "updateReportFeeDetail.do?fromType=fromEdit&feeReportId=${feeReport.feeReportId}";
				}
			}
			//数据上报
			function reportData(feeReportId)
			{
				if(confirm("确认上报？"))
				{
					ModalWindow("jump.do?path=reportFeeDetail.do&feeReportId=${feeReport.feeReportId}",640,480);
					window.location.href="listReportFeeDetail.do";
				}
			}
			//返回
			function goBack()
			{
				window.location.href="listReportFeeDetail.do";
			}
			$(document).ready(function()
			{
				//页面从何处调用，直接进入修改或修改数据后重新加载
				var fromType = "${param.fromType}";
				if(fromType=="fromEdit")
					xjTabs.initTab({firstTabSeq:1});
				else
					xjTabs.initTab();
			});
			//查看费用明细
			function showData(feeId)
			{
				ModalWindow("jump.do?path=showFeeDetail.do&feeId="+feeId,800,600);
			}
		</script>
	</head>
	<body>
	<form action="updateReportFeeDetail.do" name="form1" id="form1" method="post">
	<div id="body_div">
	<w:ShowTitle name="汇总上报修改" useSubmitKey="false">
	<w:TitleButton funcName="上报" onClickFunction="reportData()" urlImg="${ctx}/images/main/update.png"/>
	<w:TitleButton funcName="保存" onClickFunction="saveData()" urlImg="${ctx}/images/main/save.png"/>
	<w:TitleButton funcName="添加" onClickFunction="addData()" urlImg="${ctx}/images/main/add.png"/>
	<w:TitleButton funcName="返回" onClickFunction="goBack()" urlImg="${ctx}/images/main/back.png"/>
	</w:ShowTitle>
	<div id="body_content">
		<div class="Sliding_tab">
			<ul>
				<li></li><li><span class="tabsLink" id="setTab0" link="#">费用上报信息</span></li><li></li>
				<li></li><li><span class="tabsLink" id="setTab1" link="#">费用明细</span></li><li></li>
			</ul>
		</div>
		<table width="100%" id="content0" class="tabContent">
			<tr>
              <td width="120" class="right_align">编号</td>
              <td class="left_align">
				<input type="hidden" name="feeReport.feeReportId" value="${feeReport.feeReportId}"/>
				<input type="text" id="feeReportCode" name="feeReport.feeReportCode" value="${feeReport.feeReportCode}"/>
			  </td>
			 </tr>
            <tr>
              <td width="120" class="right_align">地区</td>
              <td class="left_align">
				${feeReport.areaName}
			  </td>
			 </tr>
			 <tr>
              <td class="right_align"><span class="left_align">事业部</span></td>
              <td class="left_align">
				${feeReport.areaDeptName}
			  </td>
			 </tr>
			<tr>
	              <td class="right_align">经手人</td>
	              <td class="left_align">
	              	${feeReport.createUserName }
	              </td>
			</tr>
			<tr>
	              <td class="right_align">核销月份</td>
	              <td class="left_align">
	              		${feeReport.feeReportYear}${feeReport.feeReportMonth }
	              		
	              </td>
			</tr>
			<tr>
	              <td class="right_align">终止日期</td>
	              <td class="left_align">
	              	<input type="text" name="feeReport.endDate" value="<fmt:formatDate value='${feeReport.endDate}' pattern="yyyy-MM-dd" />" onfocus="new WdatePicker()" readonly="readonly" class="inputCal"/>
	              </td>
			</tr>
			<tr>
	              <td class="right_align">票据金额</td>
	              <td class="left_align">
	              	${feeReport.reportBillAmount}
	              </td>
			</tr>
			<tr>
	              <td class="right_align">凭证金额</td>
	              <td class="left_align">
	              	${feeReport.reportCertificateAmount}
	              </td>
			</tr>
            
          </table>
				<table width="100%" id="content1" class="tabContent listTable">
					<tr>
                        <td width="150" class="td_title">地区</td>
                        <td class="td_title">事业部</td>
                        <td class="td_title">发生对象</td>
                        <td class="td_title">对象名称</td>
                        <td class="td_title">费用类别</td>
                        <td width="80" class="td_title">登记日期</td>
                        <td width="80" class="td_title">财务主管</td>
                        <td width="80" class="td_title">金额</td>
                        <td width="80" class="td_title">费用日期</td>
                        <td width="100" class="td_title">操作</td>
                      </tr>
					<c:forEach items="${datalist}" var="obj">
						<tr>
							<td class="left_align">${obj.areaName}</td>
							<td class="left_align">${obj.areaDeptName}</td>
							<td class="left_align">${obj.feeTarget}</td>
							<td class="left_align">${obj.targetName}</td>
							<td class="left_align">${obj.feeTypeName}</td>
							<td class="left_align"><fmt:formatDate value='${obj.createDate}' pattern="yyyy-MM-dd" /></td>
							<td class="left_align">${obj.financeSupervisorName}</td>
							<td class="left_align">${obj.billAmount+obj.certificateAmount}</td>
							<td class="left_align"><fmt:formatDate value='${obj.feeDate}' pattern="yyyy-MM-dd" /></td>
							<td>
								<a href="#" onclick="javascript:editData('${obj.feeId}')">修改</a>
								<a href="#" onclick="javascript:deleteData('${obj.feeId}')">移除</a>
								<a href="#" onclick="javascript:showData('${obj.feeId}')">查看</a>
							</td>
						</tr>
					</c:forEach>
				</table>
			</div>
		</div>	
		</form>
	</body>
</html>